package com.teamwork.module03.controller;

import com.teamwork.module03.service.RegisterService;
import com.teamwork.common.entity.common.User;
import com.teamwork.common.result.Result;
import org.springframework.validation.BindingResult;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/api/user/register")
public class RegisterController {
    @Resource
    private RegisterService registerService;

    @PostMapping
    public Result register(@Validated @RequestBody User user, BindingResult result){
        return registerService.register(user,result);
    }

    @GetMapping("/step2")
    public Result registerTwo(String username,Integer code){

        return registerService.register2(username,code);
    }




}
